/**
 * Copyright (C), 2015-2018, 北京译泰教育科技有限公司
 * FileName: Request
 * Author:   andy
 * Date:     18/1/28 下午12:57
 * Description: ${DESCRIPTION}
 * History:
 */
package org.smart4j.framework.bean;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * 封装请求信息<br>
 *
 * @author andy
 * @version V1.0
 * @date 18/1/28 下午12:57
 */
public class Request {

    /**
     * 请求方法
     */
    private String requestMethod;

    /**
     * 请求路径
     */
    private String requestPath;

    public Request(String requestMethod, String requestPath) {
        this.requestMethod = requestMethod;
        this.requestPath = requestPath;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }

    public String getRequestPath() {
        return requestPath;
    }

    public void setRequestPath(String requestPath) {
        this.requestPath = requestPath;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) { return true; }

        if (o == null || getClass() != o.getClass()) { return false; }

        Request request = (Request)o;

        return new EqualsBuilder()
            .append(requestMethod, request.requestMethod)
            .append(requestPath, request.requestPath)
            .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
            .append(requestMethod)
            .append(requestPath)
            .toHashCode();
    }
}
